package com.woniu.aiclient.controller;

import com.woniu.aiclient.entity.AiMsg;
import com.woniu.aiclient.entity.dto.UserInputDTO;
import com.woniu.aiclient.service.AiPOIService;
import com.woniu.aiclient.service.RecommendedService;
import com.woniu.internalcommon.dto.ResponseResult;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ai")
@CrossOrigin
public class AiPOIController {
    @Resource
    private AiPOIService aiPOIService;
    @Resource
    private RecommendedService recommendedService;
    @Resource
    StringRedisTemplate stringRedisTemplate;






//    @PostMapping("/getPOIMessage")
//    public ResponseResult<AiMsg> getPOIMessage(@RequestBody UserInputDTO userInputDTO) {
//        System.out.println(userInputDTO);
//        AiMsg poiMessage = aiPOIService.
//                getPOIMessage(userInputDTO.getLocation(),
//                        userInputDTO.getKeywords(),
//                        userInputDTO.getCitycode(),
//                        userInputDTO.getIsKeywords());
//        if (poiMessage != null) {
//            return ResponseResult.success(poiMessage);
//        }else
//            return ResponseResult.fail(poiMessage);
//    }

    @PostMapping("/getPOIMessage")
    public ResponseResult<AiMsg> getPOIMessage(@RequestBody UserInputDTO userInputDTO) {
        AiMsg poiMessage = aiPOIService.getPOIMessage(userInputDTO.getLocation(),
                userInputDTO.getKeywords(),
                userInputDTO.getCitycode(),
                userInputDTO.getIsKeywords());
        System.out.println(poiMessage);
        return ResponseResult.success(poiMessage);

    }
    @GetMapping("/deleteMemary")
    public ResponseResult deleteMemary(@RequestParam("phone") String phone) {
        stringRedisTemplate.delete("17640122174");
        return ResponseResult.success();
    }




}
